package com.nuanshui.heatedloan.credit.service;

import com.nuanshui.framework.consts.TransactionManagerType;
import com.nuanshui.heatedloan.constant.ServiceConstant;
import com.nuanshui.heatedloan.credit.dal.mapper.CustomerBaseInfoMapper;
import com.nuanshui.heatedloan.credit.facade.CustomerBaseInfoService;
import com.nuanshui.heatedloan.credit.form.CustomerBaseInfoForm;
import com.nuanshui.heatedloan.credit.vo.CustomerBaseInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;



@Transactional(readOnly=true,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
@Service(ServiceConstant.CUSTOMERBASEINFOSERVICE)
public class CustomerBaseInfoServiceImpl implements CustomerBaseInfoService{
    
	@Autowired
	private CustomerBaseInfoMapper customerBaseInfoMapper;
	
	@Override
	@Transactional(readOnly=false,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
	public void saveCustomerBaseInfo(CustomerBaseInfoForm customerBaseInfoForm) {
		customerBaseInfoMapper.saveCustomerBaseInfo(customerBaseInfoForm);
	}

	@Override
	@Transactional(readOnly=false,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
	public void updateCustomerBaseInfo(CustomerBaseInfoForm customerBaseInfoForm) {
		customerBaseInfoMapper.updateCustomerBaseInfo(customerBaseInfoForm);
	}

	@Override
	public CustomerBaseInfoVO loadVO(String id) {
		return customerBaseInfoMapper.loadVO(id);
	}

	@Override
	@Transactional(readOnly=false,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
	public void deleteCustomerBaseInfo(String id) {
		customerBaseInfoMapper.deleteCustomerBaseInfo(id);
	}


	public CustomerBaseInfoVO getCustomerBaseInfoByUserId(String userId){
		CustomerBaseInfoVO customerBaseInfoVO=customerBaseInfoMapper.getCustomerBaseInfoByUserId(userId);
		return customerBaseInfoVO;
	}
}
